<template>
  <div class="searchMain">
    <el-card v-for="(obj,index) in searchList" class="listCard" :body-style="{height:'180px'}" v-if="index<8">
        <el-row>
            <el-col :span="4">
                <div class="block">
                    <el-avatar :size="150" :src="obj.shoppicture"></el-avatar>
                </div>
            </el-col>
            <el-col :span="12" style="height: 180px">
                <div style="float: left;height: 100%">
                    <h1>{{obj.shopname}}</h1>
                    <div class="bottom clearfix">
                        <el-rate
                                v-model="obj.score"
                                disabled
                                show-score
                                text-color="#ff9900"
                                score-template="{value}分"
                                style="line-height: 20px">
                        </el-rate>
                        <el-divider></el-divider>
                        <p>{{ obj.shopAddress }}</p>
                    </div>
                </div>
            </el-col>
            <el-col :span="8" style="height: 180px;position: relative" >
                <el-button
                        type="text"
                        class="button"
                        style="display: block;font-size: 16px;position: absolute;bottom: 10px;right: 50px"
                        @click="toShow(obj)">
                    进店看看
                    <i class="el-icon-right"></i>
                </el-button>
            </el-col>
        </el-row>
    </el-card>
  </div>
</template>

<script>
export default {
    inject:['reload'],
    data(){
        return{
            searchList:[]
        }
    },
    methods:{
        getList(){
            let obj = decodeURIComponent(this.$route.params.objList);
            this.searchList = JSON.parse(obj);
            console.log(this.searchList)
        },
        toShow(showOne){
            var One = JSON.stringify(showOne)
            this.$router.push('/storeShow/'+encodeURIComponent(One))
        }
    },
    created() {
        this.getList()
    },
    watch:{
      $route:{
          handler(){
              this.reload();
          }
      }
    }
}
</script>

<style scoped>
.searchMain{
    width: 100%;
    height: 100%;
    min-height: 600px;
}
.listCard{
    height: 220px;
    margin-bottom: 10px;
}
.block{
    width: 170px;
    margin: 13px 20px;
}
h1{
    font-size: 27px;
    line-height: 30px;
    font-weight: 400;
    color: #606266;
    margin-top: 15px;
}
.bottom {
    margin-top: 65px;
    line-height: 18px;
}
.clearfix:before,
.clearfix:after {
    display: table;
    content: "";
}

.clearfix:after {
    clear: both
}
.el-divider--horizontal{
    margin: 5px 0;
}
.el-rate>>>.el-rate__icon{
    font-size: 20px !important;
    margin-right: 0 !important;
}
.el-rate>>>.el-rate__text{
    font-size: 15px;
    vertical-align: top;
    margin-left: 2px;
}
::v-deep .el-card.is-always-shadow{
    box-shadow: 0 0 20px 0 rgba(0,0,0,.1)
}
</style>